package com.ruoyi.controller.jpjs.empquit;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.mapper.jpjs.empquit.EmpQuitMapper;
import com.ruoyi.service.jpjs.PublicService;
import com.ruoyi.service.jpjs.empquit.EmpQuitService;
import com.ruoyi.util.BaseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * 离职人员
 * author:zeo
 */

@Controller
@RequestMapping("/empQuit")
public class EmpQuitController extends BaseController {
    @Autowired
    EmpQuitService empQuitService;

    @Autowired
    PublicService publicService;

    private String prefix = "jpjs/empquit";


    @GetMapping()
    public String empQuit(ModelMap mmap) {
        mmap.put("userComp", publicService.findUserCompAndJszb());
        return prefix + "/empQuit";
    }

    @RequestMapping("/list")
    @ResponseBody
    public TableDataInfo list(@RequestParam Map map) {
        startPage();
        return getDataTable(empQuitService.list(map));
    }


    @GetMapping("/edit/{id}")
    public String edit(ModelMap mmap,@PathVariable("id") String id) {
        mmap.put("data",empQuitService.findDataById(id));
        mmap.put("userComp", publicService.findUserCompAndJszb());
        return prefix + "/edit";
    }

    @RequestMapping("/edit")
    @ResponseBody
    public AjaxResult edit(@RequestParam Map map) {
        return toAjax(empQuitService.edit(map));
    }


}

